package com.ruoyi.gateway.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gateway.mapper.DeviceMapMapper;
import com.ruoyi.gateway.domain.dto.DeviceMap;
import com.ruoyi.gateway.service.IDeviceMapService;

/**
 * 设备映射Service业务层处理
 *
 * @author 白向阳
 * @date 2025-09-28
 */
@Service
public class DeviceMapServiceImpl implements IDeviceMapService
{
    @Autowired
    private DeviceMapMapper deviceMapMapper;

    /**
     * 查询设备映射
     *
     * @param id 设备映射主键
     * @return 设备映射
     */
    @Override
    public DeviceMap selectDeviceMapById(Long id)
    {
        return deviceMapMapper.selectDeviceMapById(id);
    }

    /**
     * 查询设备映射列表
     *
     * @param deviceMap 设备映射
     * @return 设备映射
     */
    @Override
    public List<DeviceMap> selectDeviceMapList(DeviceMap deviceMap)
    {
        return deviceMapMapper.selectDeviceMapList(deviceMap);
    }

    /**
     * 新增设备映射
     *
     * @param deviceMap 设备映射
     * @return 结果
     */
    @Override
    public int insertDeviceMap(DeviceMap deviceMap)
    {
        deviceMap.setCreateTime(DateUtils.getNowDate());
        return deviceMapMapper.insertDeviceMap(deviceMap);
    }

    /**
     * 修改设备映射
     *
     * @param deviceMap 设备映射
     * @return 结果
     */
    @Override
    public int updateDeviceMap(DeviceMap deviceMap)
    {
        deviceMap.setUpdateTime(DateUtils.getNowDate());
        return deviceMapMapper.updateDeviceMap(deviceMap);
    }

    /**
     * 批量删除设备映射
     *
     * @param ids 需要删除的设备映射主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMapByIds(Long[] ids)
    {
        return deviceMapMapper.deleteDeviceMapByIds(ids);
    }

    /**
     * 删除设备映射信息
     *
     * @param id 设备映射主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMapById(Long id)
    {
        return deviceMapMapper.deleteDeviceMapById(id);
    }
}
